// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    scrollTop:0,
    swiper:[
      {img:'../../images/test.png'},
      {img:'../../images/test.png'},
      {img:'../../images/test.png'}
    ],
    iconsList:[
      {img:'../../images/img1.png',name:'美食外卖'},
      {img:'../../images/img1.png',name:'美食外卖'},
      {img:'../../images/img1.png',name:'美食外卖'},
      {img:'../../images/img1.png',name:'美食外卖'},
      {img:'../../images/img1.png',name:'美食外卖'},
      {img:'../../images/img1.png',name:'美食外卖'},
      {img:'../../images/img1.png',name:'美食外卖'},
      {img:'../../images/img1.png',name:'美食外卖'},
      {img:'../../images/img1.png',name:'美食外卖'},
      {img:'../../images/img1.png',name:'美食外卖'}
    ],
    tabList:[
      {id:1,name:'附近推荐'},
      {id:2,name:'发现好菜'},
      {id:3,name:'超市'},
      {id:4,name:'水果'},
      {id:5,name:'买菜'},
      {id:6,name:'到店付'}
    ],
    tabIndex:0,
    list:[
      {id:1,title:'汉堡王',img:'../../images/img1.png'},
      {id:1,title:'汉堡王',img:'../../images/img1.png'},
      {id:1,title:'汉堡王',img:'../../images/img1.png'},
      {id:1,title:'汉堡王',img:'../../images/img1.png'},
      {id:1,title:'汉堡王',img:'../../images/img1.png'},
      {id:1,title:'汉堡王',img:'../../images/img1.png'}
    ]
  },
  onLoad() {
    if (wx.getUserProfile) {
      this.setData({
        canIUseGetUserProfile: true
      })
    }
  },
  onPageScroll(e) {
    if (e.scrollTop < 500) {
      this.setData({
        scrollTop:e.scrollTop
      })
    }
  },
  tabChange(e) {
    let index = e.currentTarget.dataset.index
    this.setData({
      tabIndex:index
    })
  },
  goDetails(e) {
    let id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '/pages/storeDetails/storeDetails?id='+id,
    })
  }
})
